home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / hardware / ryemouse / test.c < prev   
C/C++ Source or Header  |  1995-01-22  |  4KB  |  224 lines

  1. #include"ryemouse.h"
  2. #include<stdlib.h>
  3.  
  4. int x,y,button;
  5.  
  6. /////////////////////////////////////////////////////////////////////
  7. char getkey(void){
  8. char c=0;
  9. if(kbhit())c=getch();
  10. return c;
  11. }
  12. /////////////////////////////////////////////////////////////////////
  13. void demo1(void){
  14. asm{
  15. mov ax,0x0012
  16. int 0x10
  17. }
  18. gotoxy(1,1);
  19. printf("Press any key to exit.");
  20. do{
  21. showmouse();
  22. delay(200);
  23. hidemouse();
  24. delay(200);
  25. }while(!getkey());
  26. }
  27. /////////////////////////////////////////////////////////////////////
  28. void demo2(void){
  29. asm{
  30. mov ax,0x0003
  31. int 0x10
  32. }
  33. gotoxy(1,1);
  34. printf("The following is an example of graphics cursors. It will stop\nautomatically.\n");
  35. delay(5000);
  36. asm{
  37. mov ax,0x0003
  38. int 0x10
  39. }
  40. showmouse();
  41. delay(1000);
  42. asm{
  43. mov ax,0x0004
  44. int 0x10
  45. }
  46. showmouse();
  47. delay(1000);
  48. asm{
  49. mov ax,0x0005
  50. int 0x10
  51. }
  52. showmouse();
  53. delay(1000);
  54. asm{
  55. mov ax,0x0006
  56. int 0x10
  57. }
  58. showmouse();
  59. delay(1000);
  60. asm{
  61. mov ax,0x000D
  62. int 0x10
  63. }
  64. showmouse();
  65. delay(1000);
  66. asm{
  67. mov ax,0x000E
  68. int 0x10
  69. }
  70. showmouse();
  71. delay(1000);
  72. asm{
  73. mov ax,0x000F
  74. int 0x10
  75. }
  76. showmouse();
  77. delay(1000);
  78. asm{
  79. mov ax,0x0010
  80. int 0x10
  81. }
  82. showmouse();
  83. delay(1000);
  84. asm{
  85. mov ax,0x0011
  86. int 0x10
  87. }
  88. showmouse();
  89. delay(1000);
  90. asm{
  91. mov ax,0x0012
  92. int 0x10
  93. }
  94. showmouse();
  95. delay(1000);
  96. asm{
  97. mov ax,0x0013
  98. int 0x10
  99. }
  100. showmouse();
  101. delay(1000);
  102. asm{
  103. mov ax,0x0003
  104. int 0x10
  105. }
  106. }
  107. /////////////////////////////////////////////////////////////////////
  108. void demo3(void){
  109. asm{
  110. mov ax,0x0012
  111. int 0x10
  112. }
  113. gotoxy(1,1);
  114. printf("Bounding box from 220,140 - 420,340.\n");
  115. printf("Press any key...");
  116. setxlimit(220,420);
  117. setylimit(140,340);
  118. showmouse();
  119. while(!getkey());
  120. }
  121. /////////////////////////////////////////////////////////////////////
  122. void demo4(void){
  123. asm{
  124. mov ax,0x0012
  125. int 0x10
  126. }
  127. showmouse();
  128. gotoxy(1,20);
  129. printf("Press any key...");
  130. do{
  131. getmouse(&x,&y,&button);
  132. gotoxy(1,1);
  133. printf("X:%3d    Y:%3d    Buttons:%1d",x,y,button);
  134. }while(!getkey());
  135. }
  136. /////////////////////////////////////////////////////////////////////
  137. void demo5(void){
  138. asm{
  139. mov ax,0x0012
  140. int 0x10
  141. }
  142. showmouse();
  143. gotoxy(1,1);
  144. printf("Press any key...");
  145. do{
  146. setmousepos(random(639),random(479));
  147. delay(100);
  148. }while(!getkey());
  149. }
  150. /////////////////////////////////////////////////////////////////////
  151. void demo6(void){
  152. asm{
  153. mov ax,0x0012
  154. int 0x10
  155. }
  156. showmouse();
  157. gotoxy(1,1);
  158. printf("This is an example of mouse motion scanning\nPress any key...");
  159. do{
  160. delay(100);
  161. getmotion(&x,&y);
  162. gotoxy(1,20);
  163. printf("X motion:%5d    Y motion:%5d",x,y);
  164. }while(!getkey());
  165. }
  166. /////////////////////////////////////////////////////////////////////
  167. void main(void){
  168.  
  169. char key=0;
  170. int x,y,button;
  171. initmouse();
  172.  
  173. asm{
  174. mov ax,0x0003
  175. int 0x10
  176. }
  177.  
  178. do{
  179.  
  180. asm{
  181. mov ax,0x0003
  182. int 0x10
  183. }
  184.  
  185. gotoxy(1,1);
  186. printf("Ryemouse.lib demo program\n\nHit letter to see demo.\n\n");
  187. printf("a) Show/hide mouse demo.\n");
  188. printf("b) Graphics mode cursors.\n");
  189. printf("c) Bounding box demo.\n");
  190. printf("d) Getmouse demo.\n");
  191. printf("e) Setmousepos demo.\n");
  192. printf("f) Getmotion demo.\n");
  193. printf("g) Grand tour of all demos.\n");
  194. printf("\nESC to exit\n");
  195.  
  196. do{
  197. key=getkey();
  198. }while(!key);
  199.  
  200. if(key==97)demo1();
  201. if(key==98)demo2();
  202. if(key==99)demo3();
  203. if(key==100)demo4();
  204. if(key==101)demo5();
  205. if(key==102)demo6();
  206. if(key==103){
  207. demo1();
  208. demo2();
  209. demo3();
  210. demo4();
  211. demo5();
  212. demo6();
  213. }
  214.  
  215. }while(key!=27);
  216.  
  217. asm{
  218. mov ax,0x0003
  219. int 0x10
  220. }
  221.  
  222. }
  223. /////////////////////////////////////////////////////////////////////
  224.